import { ListNode } from "./ListNode.mjs";
/**
 * @param {ListNode} headA
 * @param {ListNode} headB
 * @return {ListNode}
 */
var getIntersectionNode = function (headA, headB) {
  if (!headA || !headB) return null;
  let you = headA,
    she = headB;
  while (you != she) {
    you = you ? you.next : headB;
    she = she ? she.next : headA;
  }

  return you;
};
